import { Suspense } from 'react';
import { useRoutes } from 'react-router-dom';

import routes from '@routes/routes';
import { generateRoute } from '@routes/config';
import Loading from '@/components/Loading';

import './App.css';

const App = () => {
  const routesConfig = generateRoute(routes);
  const element = useRoutes(routesConfig as any);

  return <Suspense fallback={<Loading />}>{element}</Suspense>;
};

export default App;
